﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SocialPlatformSDK.Model;
using SocialPlatformSDK.Util;

namespace SocialPlatformSDK
{

    public class SinaCodeToken : CodeToken
    {



        /// <summary>
    
        public override void LoadToken(string content)
        {
            var result = OAuthHelper.GetQueryParameters(content);

            // 通过content, 初始化 Key 和 Secret
            if (result.ContainsKey("code"))
            {
                this.Code = result["code"];
            }      
        }
     
    }


    public class SinaAccessToken : AccessToken
    {
        public String RemindIn { get; set; } 
        public override void LoadToken(string content)
        {
            var jo = JObject.Parse(content);
            this.AccesssToken = jo["access_token"].ToString();
            this.RemindIn = jo["remind_in"].ToString();
            this.ExpriesIn = jo["expires_in"].ToString();
            
        }
    }
}
